package com.wsseieiei.fireballgame.init;


import com.google.common.base.Supplier;
import com.wsseieiei.fireballgame.Main;
import com.wsseieiei.fireballgame.items.*;
import net.minecraft.world.item.Item;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject;

public class ItemInit {
    //注册机
    public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS,
            Main.MOD_ID);

    //定义物品
    public static final RegistryObject<Item> ERROR_CORE = register("error_core",
            () -> new Item(new Item.Properties().tab(Main.FIREBALL_GAME_TAB)));

    public static final RegistryObject<Item> LIGHT_FLAME = register("light_flame",
            () -> new Item(new Item.Properties().tab(Main.FIREBALL_GAME_TAB)));

    public static RegistryObject<Item> SLIME_PLATE = register("big_core", ItemSlimePlate::new);

    public static RegistryObject<Item> BALL = register("firefox_ball",()->
            new ItemBall((new Item.Properties()).stacksTo(16).tab(Main.FIREBALL_GAME_TAB)));

    public static RegistryObject<Item> FIREBALL_SHOOTER = register("fireball_shooter",()->
    {
        return new ItemSmallfireballShooter((new Item.Properties()).stacksTo(1).tab(Main.FIREBALL_GAME_TAB));
    });

    public static RegistryObject<Item> BALLPLUS = register("super_ball", ItemBallPlus::new);

    public static RegistryObject<Item> LIGHTER = register("lighter", ItemLighter::new);

    public static RegistryObject<Item> PREATTACK = register("core_sword", ItemPreAttack::new);

    public static RegistryObject<Item> PREMINE = register("core_pickaxe", ItemPreMine::new);

    //食物注册
    public static RegistryObject<ItemFoodPack> FOOD_PACK =
            ITEMS.register("food_pack", ItemFoodPack::new);

    //刷怪蛋注册,格式:ForgeSpawnEggItem(生物类,颜色1,颜色2,放在哪个物品栏)
    public static final RegistryObject<Item> THIEF_EGG = ITEMS.register("synthesis_body_spawn_egg",
            () -> new ForgeSpawnEggItem(EntityInit.SB, 9577503, 9577503,new Item.Properties().tab(Main.FIREBALL_GAME_TAB)));


    private static <T extends Item> RegistryObject<T> register(final String name, final Supplier<T> item) {
        return ITEMS.register(name, item);
    }

}
